import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";

// 查询租户列表
export function listTenantUser(query) {
  return request({
    url: '/tenant/user/list',
    method: 'get',
    params: query
  })
}
// 查询授权角色
export function getAuthRole(userId) {
  return request({
    url: '/tenant/user/authRole/' + userId,
    method: 'get'
  })
}
// 保存授权角色
export function updateAuthRole(data) {
  return request({
    url: '/tenant/user/authRole',
    method: 'put',
    params: data
  })
}

// 查询租户详细
export function getTenantUser(userId) {
  return request({
    url: '/tenant/user/' + parseStrEmpty(userId),
    method: 'get'
  })
}

// 新增租户
export function addTenantUser(data) {
  return request({
    url: '/tenant/user/addTenantUser',
    method: 'post',
    data: data
  })
}

// 修改租户
export function updateTenantUser(data) {
  return request({
    url: '/tenant/user',
    method: 'put',
    data: data
  })
}

// 删除租户
export function delTenantUser(userIds) {
  return request({
    url: '/tenant/user/' + userIds,
    method: 'delete'
  })
}

// 停用
export function updateTenantUserStatus(data) {
  return request({
    url: '/tenant/user/updateTenantUserStatus',
    method: 'put',
    data: data
  })
}
